<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace com\vip\wpc\ospservice\vop;

class WpcVopOrderDetailVo {
	
	static $_TSPEC;
	public $orderSn = null;
	public $h5ChannelId = null;
	public $statusName = null;
	public $statusCode = null;
	public $amount = null;
	public $h5ChannelOpenId = null;
	public $goods = null;
	public $parentOrderSn = null;
	public $orderCreateTime = null;
	public $orderSignTime = null;
	public $orderPayTime = null;
	public $commissionRewardTime = null;
	public $rewardMoney = null;
	public $rewardTotalMoney = null;
	public $refundRewardMoney = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			12001 => array(
			'var' => 'orderSn'
			),
			12002 => array(
			'var' => 'h5ChannelId'
			),
			12003 => array(
			'var' => 'statusName'
			),
			12004 => array(
			'var' => 'statusCode'
			),
			12005 => array(
			'var' => 'amount'
			),
			12006 => array(
			'var' => 'h5ChannelOpenId'
			),
			12007 => array(
			'var' => 'goods'
			),
			12008 => array(
			'var' => 'parentOrderSn'
			),
			12009 => array(
			'var' => 'orderCreateTime'
			),
			12010 => array(
			'var' => 'orderSignTime'
			),
			12011 => array(
			'var' => 'orderPayTime'
			),
			12012 => array(
			'var' => 'commissionRewardTime'
			),
			12013 => array(
			'var' => 'rewardMoney'
			),
			12014 => array(
			'var' => 'rewardTotalMoney'
			),
			12015 => array(
			'var' => 'refundRewardMoney'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['orderSn'])){
				
				$this->orderSn = $vals['orderSn'];
			}
			
			
			if (isset($vals['h5ChannelId'])){
				
				$this->h5ChannelId = $vals['h5ChannelId'];
			}
			
			
			if (isset($vals['statusName'])){
				
				$this->statusName = $vals['statusName'];
			}
			
			
			if (isset($vals['statusCode'])){
				
				$this->statusCode = $vals['statusCode'];
			}
			
			
			if (isset($vals['amount'])){
				
				$this->amount = $vals['amount'];
			}
			
			
			if (isset($vals['h5ChannelOpenId'])){
				
				$this->h5ChannelOpenId = $vals['h5ChannelOpenId'];
			}
			
			
			if (isset($vals['goods'])){
				
				$this->goods = $vals['goods'];
			}
			
			
			if (isset($vals['parentOrderSn'])){
				
				$this->parentOrderSn = $vals['parentOrderSn'];
			}
			
			
			if (isset($vals['orderCreateTime'])){
				
				$this->orderCreateTime = $vals['orderCreateTime'];
			}
			
			
			if (isset($vals['orderSignTime'])){
				
				$this->orderSignTime = $vals['orderSignTime'];
			}
			
			
			if (isset($vals['orderPayTime'])){
				
				$this->orderPayTime = $vals['orderPayTime'];
			}
			
			
			if (isset($vals['commissionRewardTime'])){
				
				$this->commissionRewardTime = $vals['commissionRewardTime'];
			}
			
			
			if (isset($vals['rewardMoney'])){
				
				$this->rewardMoney = $vals['rewardMoney'];
			}
			
			
			if (isset($vals['rewardTotalMoney'])){
				
				$this->rewardTotalMoney = $vals['rewardTotalMoney'];
			}
			
			
			if (isset($vals['refundRewardMoney'])){
				
				$this->refundRewardMoney = $vals['refundRewardMoney'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'WpcVopOrderDetailVo';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("orderSn" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->orderSn);
				
			}
			
			
			
			
			if ("h5ChannelId" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->h5ChannelId);
				
			}
			
			
			
			
			if ("statusName" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->statusName);
				
			}
			
			
			
			
			if ("statusCode" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->statusCode); 
				
			}
			
			
			
			
			if ("amount" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->amount);
				
			}
			
			
			
			
			if ("h5ChannelOpenId" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->h5ChannelOpenId);
				
			}
			
			
			
			
			if ("goods" == $schemeField){
				
				$needSkip = false;
				
				$this->goods = array();
				$_size1 = 0;
				$input->readListBegin();
				while(true){
					
					try{
						
						$elem1 = null;
						
						$elem1 = new \com\vip\wpc\ospservice\vop\WpcVopOrderGoodsVo();
						$elem1->read($input);
						
						$this->goods[$_size1++] = $elem1;
					}
					catch(\Exception $e){
						
						break;
					}
				}
				
				$input->readListEnd();
				
			}
			
			
			
			
			if ("parentOrderSn" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->parentOrderSn);
				
			}
			
			
			
			
			if ("orderCreateTime" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->orderCreateTime);
				
			}
			
			
			
			
			if ("orderSignTime" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->orderSignTime);
				
			}
			
			
			
			
			if ("orderPayTime" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->orderPayTime);
				
			}
			
			
			
			
			if ("commissionRewardTime" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->commissionRewardTime);
				
			}
			
			
			
			
			if ("rewardMoney" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->rewardMoney);
				
			}
			
			
			
			
			if ("rewardTotalMoney" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->rewardTotalMoney);
				
			}
			
			
			
			
			if ("refundRewardMoney" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->refundRewardMoney);
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		if($this->orderSn !== null) {
			
			$xfer += $output->writeFieldBegin('orderSn');
			$xfer += $output->writeString($this->orderSn);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->h5ChannelId !== null) {
			
			$xfer += $output->writeFieldBegin('h5ChannelId');
			$xfer += $output->writeString($this->h5ChannelId);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->statusName !== null) {
			
			$xfer += $output->writeFieldBegin('statusName');
			$xfer += $output->writeString($this->statusName);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->statusCode !== null) {
			
			$xfer += $output->writeFieldBegin('statusCode');
			$xfer += $output->writeI32($this->statusCode);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->amount !== null) {
			
			$xfer += $output->writeFieldBegin('amount');
			$xfer += $output->writeString($this->amount);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->h5ChannelOpenId !== null) {
			
			$xfer += $output->writeFieldBegin('h5ChannelOpenId');
			$xfer += $output->writeString($this->h5ChannelOpenId);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->goods !== null) {
			
			$xfer += $output->writeFieldBegin('goods');
			
			if (!is_array($this->goods)){
				
				throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
			}
			
			$output->writeListBegin();
			foreach ($this->goods as $iter0){
				
				
				if (!is_object($iter0)) {
					
					throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
				}
				
				$xfer += $iter0->write($output);
				
			}
			
			$output->writeListEnd();
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->parentOrderSn !== null) {
			
			$xfer += $output->writeFieldBegin('parentOrderSn');
			$xfer += $output->writeString($this->parentOrderSn);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->orderCreateTime !== null) {
			
			$xfer += $output->writeFieldBegin('orderCreateTime');
			$xfer += $output->writeString($this->orderCreateTime);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->orderSignTime !== null) {
			
			$xfer += $output->writeFieldBegin('orderSignTime');
			$xfer += $output->writeString($this->orderSignTime);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->orderPayTime !== null) {
			
			$xfer += $output->writeFieldBegin('orderPayTime');
			$xfer += $output->writeString($this->orderPayTime);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->commissionRewardTime !== null) {
			
			$xfer += $output->writeFieldBegin('commissionRewardTime');
			$xfer += $output->writeString($this->commissionRewardTime);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->rewardMoney !== null) {
			
			$xfer += $output->writeFieldBegin('rewardMoney');
			$xfer += $output->writeString($this->rewardMoney);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->rewardTotalMoney !== null) {
			
			$xfer += $output->writeFieldBegin('rewardTotalMoney');
			$xfer += $output->writeString($this->rewardTotalMoney);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->refundRewardMoney !== null) {
			
			$xfer += $output->writeFieldBegin('refundRewardMoney');
			$xfer += $output->writeString($this->refundRewardMoney);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>